//
// Created by jerry on 2024/10/11.
//
#include "vector.h"
#include "list.h"
#ifndef DATASTRUCTURE_QUEUE_H
#define DATASTRUCTURE_QUEUE_H

namespace mycode{
    template<class T,class Container = mycode::list<T>>
    class queue{
    public:
        using Self = queue<T,Container>;
        using Ref = queue<T,Container>&;
        using Ptr = queue<T,Container>*;
        explicit queue() = default;
        size_t size() const { return _con.size(); }
        bool empty() const { return _con.empty(); }
        void swap(queue<T>& rq){
            _con.swap(rq._con);
        }
        explicit queue(const Ref que):_con(que._con)
        {}
        explicit queue(queue<T>&& rq):_con(std::move(rq._con))
        {}
        Ref operator=(Self que){
            _con.swap(que._con);
            return *this;
        }
        Ref operator=(queue<T>&& rq){
            _con = std::move(rq._con);
            return *this;
        }
        template <class Elem>
        void push(Elem&& val){ _con.push_back(std::forward<Elem>(val));}
        void pop(){ _con.erase(_con.begin()); }

    private:
        Container _con;
    };
}
#endif //DATASTRUCTURE_QUEUE_H
